<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Blade::setContentTags('<%', '%>'); 		// for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>'); 	// for escaped data

Route::get('/', function()
{
	return View::make('index');
});

Route::group(['prefix' => 'api', 'before' => ''], function() {
    Route::resource('categories', 'Api\CategoriesController');
    Route::resource('jobs', 'Api\JobsController');
	Route::resource('resumes', 'Api\ResumesController');
    Route::resource('news', 'Api\NewsController');
    Route::resource('products', 'Api\ProductsController');
});

Route::group(['prefix' => 'admin', 'before' => 'auth'], function() {
    Route::get('/', function()
    {
        return View::make('hello');
    });
    Route::resource('category', 'CategoriesController');
    Route::resource('jobs', 'JobsController');
	Route::resource('resumes', 'ResumesController');
    Route::resource('products', 'ProductsController');
    Route::resource('news', 'NewsController');
});

Route::get('login', 'AuthController@login');
Route::post('auth', 'AuthController@auth');
Route::get('logout', array('as' => 'logout', 'uses' => 'AuthController@logout'));

HTML::macro('nav_link', function($route, $text, $icon = 'question-sign',$title = null) {
    if( Request::is($route)) {
        $active = 'class="active"';
    }
    else {
        $active = '';
    }

    return '<li><a ' . $active . ' href="'.url($route).'" title="'.$title.'"><span class="sub_icon glyphicon glyphicon-'.$icon.'"></span> '.$text.' </a>' . '</li>';
});
HTML::macro('nav_links', function($route, $text, $icon = 'question-sign',$title = null) {
    if( Request::is($route)||Request::is($route.'/*')) {
        $active = 'class="active"';
    }
    else {
        $active = '';
    }

    return '<li><a ' . $active . ' href="'.url($route).'" title="'.$title.'"><span class="sub_icon glyphicon glyphicon-'.$icon.'"></span> '.$text.' </a>' . '</li>';
});
